import request from "@/libs/request";

const basePath = '/appcloud-deploy-api' ;


export const apiUrls = {
		deleteSL : basePath + '/instance/delete/',
		deploy : basePath + '/instance/deploy/',
    destroy : basePath + '/instance/destroy/',
    getHistoryInstList : basePath + "/instance/getHistoryInstList",
    restart : basePath + '/instance/restart/',
    rollback : basePath +   "/instance/rollback/",
    start : basePath + '/instance/start/',
    stop : basePath + '/instance/stop/',
    upgrade : basePath +  "/instance/upgrade",
    clone: basePath + "/instance/clone"
}

// 删除
export async function deleteSL(id){
	return request( apiUrls.deleteSL + id , {
      method:'GET',
  })
}


// 发布
export async function deploy(params){
	return request( apiUrls.deploy, {
      method:'POST',
      body:params
  })
}


// 销毁
export async function destroy(params){
	return request( apiUrls.destroy + params.id , {
      method:'POST',
  })
}

 
// 获取历史实例列表
export async function getHistoryInstList(params){
	return request( apiUrls.getHistoryInstList, {
      method:'POST',
      body:params
  })
}


// 重启
export async function restart(params){
	return request( apiUrls.restart + params.id , {
      method:'POST',
  })
}


// 回滚
export async function rollback(params){
	return request( apiUrls.rollback + params.id , {
      method:'GET',
  })
}



// 启动
export async function start(params){
	return request( apiUrls.start + params.id , {
      method:'POST',
  })
}

// 停止
export async function stop(params){
	return request( apiUrls.stop  + params.id , {
      method:'POST',
  })
}

// 升级
export async function upgrade(params){
	return request( apiUrls.upgrade , {
      method:'POST',
      body:params
  })
}

// 克隆
export async function clone(params){
	return request( apiUrls.clone , {
      method:'POST',
      body:params
  })
}
